package com.mt.restaurant.entity.material;

import javax.persistence.*;
import java.io.Serializable;

import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


@DEntity(label = "订单材料关系", comment = "", moduleLabel = "原材料管理")
@Entity(name = "restaurant_order_material_relation")
@Table(name = "restaurant_order_material_relation", indexes = {})
@ApiModel(description = "订单材料关系:")
public class OrderMaterialRelation extends Supplier implements Serializable {
    private static final long serialVersionUID = 1L;

    @DColumn(index = 3, label = "材料订单id", comment = "", component = "数字，整数", where = false)
    @ApiModelProperty(value = "材料订单id:")
    @Column(name = "material_order_id", length = 255, nullable = false, unique = false)
    private Long materialOrderId;

    @DColumn(index = 4, label = "供应原材料id", comment = "", component = "数字，整数", where = false)
    @ApiModelProperty(value = "供应原材料id:")
    @Column(name = "supply_material_id", length = 255, nullable = false, unique = false)
    private Long supplyMaterialId;

    @Transient
    private SupplyMaterial supplyMaterial;

    @DColumn(index = 5, label = "供应原材料名称", comment = "", component = "文本", where = false)
    @ApiModelProperty(value = "供应原材料名称:")
    @Column(name = "supply_material_name", length = 255, nullable = true, unique = false)
    private String supplyMaterialName;

    @Transient
    private String supplierName;

    @Transient
    private Long supplierId;

    @DColumn(index = 6, label = "数量", comment = "", component = "数字，小数", where = false)
    @ApiModelProperty(value = "数量:")
    @Column(name = "amount", length = 255, nullable = false, unique = false)
    private Double amount;

    @DColumn(index = 6, label = "价格", comment = "", component = "数字，小数", where = false)
    @ApiModelProperty(value = "价格:")
    @Column(name = "price", length = 255, nullable = false, unique = false)
    private Double price;

    @Transient
    private Long materialId;

    public Long getMaterialOrderId() {
        return this.materialOrderId;
    }

    public void setMaterialOrderId(Long materialOrderId) {
        this.materialOrderId = materialOrderId;
    }

    public Long getSupplyMaterialId() {
        return supplyMaterialId;
    }

    public void setSupplyMaterialId(Long supplyMaterialId) {
        this.supplyMaterialId = supplyMaterialId;
    }

    public SupplyMaterial getSupplyMaterial() {
        return supplyMaterial;
    }

    public void setSupplyMaterial(SupplyMaterial supplyMaterial) {
        this.supplyMaterial = supplyMaterial;
    }

    public String getSupplyMaterialName() {
        return supplyMaterialName;
    }

    public void setSupplyMaterialName(String supplyMaterialName) {
        this.supplyMaterialName = supplyMaterialName;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public Double getAmount() {
        return this.amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Long getMaterialId() {
        return materialId;
    }

    public void setMaterialId(Long materialId) {
        this.materialId = materialId;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public Double getTotalPrice(){
        return this.price*this.amount;
    }
}
